Skip to content

can config es id's constituent part #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 14, 2017

Conversation

WangXiangUSTC
Copy link
Contributor

default the es's id use mysql's PK value, and now can config the id's constituent part use mysql's other column.

river/rule.go Outdated
@@ -13,6 +13,7 @@ type Rule struct {
Index string `toml:"index"`
Type string `toml:"type"`
Parent string `toml:"parent"`
Id []string `toml:"id"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g/Id/ID/s

river/sync.go Outdated
pks, err := canal.GetPKValues(rule.TableInfo, row)
if err != nil {
return "", err
var id []interface{}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var (
  ids []interface{}
  err error 
)

@siddontang
Copy link
Collaborator

Please add test for this feature.

@WangXiangUSTC
Copy link
Contributor Author

I have changed Id to ID, and add test, but can't pass the check.
could you tell me how to run test file in my computer? Or you can modify the test file.

etc/river.toml Outdated
@@ -58,6 +58,8 @@ schema = "test"
table = "t"
index = "test"
type = "t"
# Default will use the mysql's primary key as es's id, if set id will use the id's column value as id
id = ["id", "tags"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use another rule section for this feature.
Btw, please add this to ReadMe too.

@siddontang
Copy link
Collaborator

Rest LGTM

@siddontang
Copy link
Collaborator

CI failed, please fix it.

@WangXiangUSTC
Copy link
Contributor Author

ok

@WangXiangUSTC
Copy link
Contributor Author

I have already modify the readme and example config file, and ci check passed

@@ -53,6 +53,16 @@ func GetPKValues(table *schema.Table, row []interface{}) ([]interface{}, error)
return values, nil
}

// Get term column's value
func GetColumnValue(table *schema.Table, column string, row []interface{}) (interface{}, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update go-mysql commit version in glide.yml

Copy link
Collaborator

@siddontang siddontang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

@WangXiangUSTC
Copy link
Contributor Author

done

@siddontang siddontang merged commit c48878b into go-mysql-org:master Apr 14, 2017
@siddontang
Copy link
Collaborator

Thanks @WangXiangUSTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants